package com.leyou.item.api;


import com.leyou.common.vo.PageResult;
import com.leyou.item.pojo.Sku;
import com.leyou.item.pojo.Spu;
import com.leyou.item.pojo.SpuDetail;
import org.springframework.web.bind.annotation.*;


import java.util.List;


@RequestMapping("goods")
public interface GoodsApi {

    /**
     * 分页查询SPU
     *
     * @param page
     * @param rows
     * @param key
     * @return
     */
    @GetMapping("/spu/page")
    PageResult<Spu> querySpuByPage(
            @RequestParam(value = "page", defaultValue = "1") Integer page,
            @RequestParam(value = "rows", defaultValue = "5") Integer rows,
            @RequestParam(value = "saleable", required = false) Boolean saleable,
            @RequestParam(value = "key", required = false) String key);

    /**
     *
     * @param spu
     * @return
     */
    @PostMapping("goods")
    Void saveGoods(@RequestBody Spu spu) ;


    /**
     *
     * @param id
     * @return
     */
    @GetMapping("spu/detail/{id}")
    SpuDetail detailById(@PathVariable("id") Long id);


    /**
     *
     * @param id
     * @return
     */
    @GetMapping("sku/list/{id}")
    List<Sku> querySkuBySpuId(@PathVariable("id") Long id);

}
